/******************************************************************* * * * Docsearch.awebrx * * * * © 1997 Yvon Rozijn * * * * Search in AWeb documentation. Generate index if requested or * * no index file exists yet. Search the index file and pass * * results on to AWeb. * * * *******************************************************************/ /******************************************************************* * * * To use this as a search engine for your own set of local HTML * * files, adjust the following variables: * * * * index = path of index file */ index = 'AWebPAth:docs/docsearch.index' /* makeindex = full command line to make the index. * * The makeindex program takes template: DIR/A/M,TO/A * * DIR = directories to search for #?.html files (not recursive) * * TO = name of index file to create */ makeindex = 'AWebPath:docs/makeindex AWebPath:docs AWebPath:docs/plugins AWebPath:docs/settings AWebPath:docs/arexx' index /* resultfile = path of file to store search result */ resultfile = 'T:docsearch' /* searchindex = full command line to search the index, the search * * argument will be appended. * * The searchindex program takes template: INDEX/A,TO/A,SEARCH/A/F * * INDEX = path of index file * * TO = path of search result * * SEARCH = string to search */ searchindex = 'AWebPath:docs/searchindex' index resultfile /* and adjust the HTML used in the search result to fit your * * application. * * * *******************************************************************/ options results options failat 20 parse source dummy1 dummy2 programname . parse arg sarg search='' regenerate='' interpret sarg if search='' & regenerate='' then exit su=upper(search) nl='0a'x if regenerate~='' | ~exists(index) then do 'chanopen "x-nil:docsearch/creating index"' ch=result 'open "x-nil:docsearch/creating index"' 'chanheader' ch '"content-type: text/html"' 'chanheader' ch '"pragma: no-cache"' doc='Creating search index*N' doc=doc || '

Creating index

*N' doc=doc || 'A search index is being created. Please be patient...' 'chandata' ch '"' || doc || '" nl' 'chanclose' ch address command makeindex end if search='' then do 'go back' exit end if ~exists(index) then exit 'chanopen "file:///nil:docsearch/' || search || '"' ch=result 'chanheader' ch '"content-type: text/html"' 'chanheader' ch '"pragma: no-cache"' doc='Search result:' search '*N' doc=doc || '*N' doc=doc || '*N' doc=doc || '

(logo)  Search result:' search '

*N' 'chandata' ch '"' || doc || '" nl' doc='
*N' doc=doc || 'Search in documentation: *N' doc=doc || '
*N' doc=doc || '
    ' 'chandata' ch '"' || doc || '" nl' 'open "file:///nil:docsearch/' || search || '"' 'allowcmd' address command searchindex '"' || search || '"' if open(f,resultfile,'R') then do do until length(block)<480 block=readch(f,480) 'chandata' ch '"' || block || '"' end call close f address command 'delete' resultfile 'quiet' end doc='
*N' doc=doc || '
Back to index*N' doc=doc || '


*N' doc=doc || 'TIP: After you have added new documentation files,*N' doc=doc || '*N' doc=doc || 'the search index for correct search results.*N
' 'chandata' ch '"' || doc || '" nl' 'chanclose' ch